﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Drawing;

namespace ProjectStudy
{
    public partial class 指定路径下创建文件夹 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected string CreateFolder(string serverPath,string folerName)
        {            
            string path = Server.MapPath(serverPath)+"/"+folerName;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            CreateFolder("~/UploadFiles", TextBox1.Text.ConvertObjToStr().Trim());
            Label1.Text = "成功生成文件夹";
            Label1.ForeColor = Color.Green;
        }
    }
}